<!--订单管理-->
<template>
  <div>
    <div v-if="isOrder && increased">
      <!--搜索条件-->
      <div class="order">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <el-form-item label="产废单位">
            <el-select v-model="formInline.companyType" placeholder="产废单位" @change="getValue">
              <el-option :label="item.companyName" :value="item.id" v-for="item in cfCompany" :key="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="处置单位">
            <el-select v-model="formInline.czCompany" placeholder="处置单位">
              <el-option :label="item.companyName" :value="item.id" v-for="item in czCompany" :key="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="运输单位">
            <el-select v-model="formInline.ysCompany" filterable remote reserve-keyword placeholder="请输入关键词" :remote-method="remoteMethod" :loading="loading">
              <el-option v-for="item in options4" :key="item.value" :label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="危废名称" class="wasteType">
            <el-select v-model="formInline.wasteType" placeholder="危废名称">
              <el-option v-for="item in wastetypeList" :key="item.id" :label="item.name" :value="item.dangerousType"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="日期区间">
            <div class="block">
              <el-date-picker v-model="formInline.timer" type="datetimerange" :picker-options="pickerOptions2" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" align="right" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd"></el-date-picker>
            </div>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="searchResult">查询</el-button>
            <el-button type="default" @click="resetConditions">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
      <!--表格展示-->
      <div class="tables">
        <div class="speculation" v-if='!isAdmin'>
          <el-button type="primary" @click="onPrimary" v-if='jugeCompanyType'>订单分配</el-button>
          <el-button type="default" @click="onIncreased" v-if='!jugeCompanyType'>手动新增</el-button>
        </div>
        <div class="speculation" v-if='isAdmin'>
          <el-button type="primary" @click="onPrimary">订单分配</el-button>
          <el-button type="default" @click="onIncreased">手动新增</el-button>
        </div>
        <div class="menuList">
          <ul class="menuTitle">
            <li>
              <span>序号</span>
            </li>
            <li>
              <span>产废单位</span>
            </li>
            <li>
              <span>处置单位</span>
            </li>
            <li>
              <span>运输单位</span>
            </li>
            <li>
              <span>危废名称</span>
            </li>
            <li>
              <span>危废类别</span>
            </li>
            <li>
              <span>拟运量</span>
            </li>
            <li>
              <span>单位</span>
            </li>
            <li>
              <span>分配时间</span>
            </li>
            <li>
              <span>订单状态</span>
            </li>
            <li>
              <span>操作</span>
            </li>
          </ul>
          <ul class="menuBody">
            <li class="menuitem currentParentMenu" v-for="(item,index) in tables" :key="item.id" style="border-bottom: 1px solid #ebeef5">
              <div style="width: 100%;" class="line">
                <div>
                  <i class="el-icon-circle-plus-outline" style="margin-right: 5px;" @click="unfold($event,item.id)"></i>
                  <span>{{++index}}</span>
                </div>
                <div>
                  <span>{{item.wfCompany}}</span>
                </div>
                <div>
                  <span>{{item.opCompany}}</span>
                </div>
                <div>
                  <span>{{item.ysCompany}}</span>
                </div>
                <div>
                  <span>{{item.origin}}</span>
                </div>
                <div>
                  <span>{{item.wfCode}}</span>
                </div>
                <div>
                  <span>{{item.wfWeight}}</span>
                </div>
                <div>
                  <span>{{item.unit}}</span>
                </div>
                <div>
                  <span>{{$dateFormat(item.createAt,'yyyy-MM-dd hh:mm:ss')}}</span>
                </div>
                <div>
                  <span style='color: #f40'>{{item.ysId==null?'待分配运输':'待调度'}}</span>
                </div>
                <div>
                  <a href="javascript:;" @click="handleEdit(item)" v-if='currentLoginCompany=4'>修改</a>
                  <a href="javascript:;" @click="recall(item)">撤回</a>
                </div>
              </div>
              <ol class="subMenu">
                <li class="subItem" v-for="son in item.children" :key="son.id">
                  <div>
                    <span>危废名称：{{son.wfName}}</span>
                  </div>
                  <div>
                    <span>重量：{{son.wfWeight}}</span>
                  </div>
                  <div>
                    <span>单位：{{son.unit}}</span>
                  </div>
                  <!-- 0:手动预警 1：自动预警 2：封袋提示 3：运输申请 4:重新确认 5:调度确认 6:运输确认 -->
                  <div>
                    <span>通知：{{son.warnType===0?'手动预警':son.warnType===1?'自动预警':son.warnType==null?'手动预警':''}}</span>
                  </div>
                </li>
              </ol>
            </li>
          </ul>
        </div>
      </div>
      <!--页数展示-->
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
      <!-- 修改 -->
      <el-dialog :title="dialogAmend" :visible.sync="dialogVisibleAmend" width="80%">
        <div class="dialogAmendTables">
          <el-table :data="dialogAmendTables">
            <el-table-column prop="wfCompany" label="产废单位"></el-table-column>
            <el-table-column prop="wfCode" label="危废类别"></el-table-column>
            <el-table-column prop="wfName" label="危废种类"></el-table-column>
            <el-table-column prop="warningTransport" label="预警量"></el-table-column>
            <el-table-column prop="total" label="当前库存量"></el-table-column>
            <el-table-column prop="unit" label="单位"></el-table-column>
            <el-table-column prop='pdCompany' label="处置单位">
            </el-table-column>
            <el-table-column label="运输单位">
              <template slot-scope='scope'>
                <el-select v-model="scope.row.ysId" placeholder="请选择运输单位" @change='updateYsCompany(scope.row.ysId,scope.row.id)'>
                  <el-option v-for="item in ysCompanyUpdate" :key="item.id" :label="item.companyName" :value="item.id"></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="运输量">
              <template slot-scope="scope">
                <el-input size="small" v-model="scope.row.wfWeight" type='number' placeholder="运输数量" @input='getCurrentWFweight(scope.row.wfWeight,scope.row.id)'></el-input>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="confirmUpdate">确认修改</el-button>
          <el-button @click="dialogVisibleAmend = false">取消</el-button>
        </span>
      </el-dialog>
    </div>
    <!--订单分配----自动-->
    <div v-if="!isOrder">
      <el-button type="text" size="medium" @click="orderGoBack">返回</el-button>
      <div class="orderAllot">
        <div class="orderAllotHead">
          <span class="orderAllotHeadInfo">运输请求单信息</span>
        </div>
        <div class="orderAllotForm">
          <div class="orderAllotFormHead">
            <el-form :inline="true" :model="transportForm" class="demo-form-inline">
              <el-form-item label="产废单位">
                <el-select v-model="transportForm.cfCompany" placeholder="产废单位">
                  <el-option :label="item.companyName" :value="item.id" v-for="item in cfCompany" :key="item.id"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" @click="onSubmitorderAllot">查询</el-button>
                <el-button type="default" @click="onResetorderAllot">重置</el-button>
              </el-form-item>
            </el-form>
          </div>
          <div>
            <div class="orderAllotFormTable">
              <el-table ref="multipleTable" :data="orderAllotTables" tooltip-effect="dark" style="width: 100%">
                <el-table-column type="index" label="序号" width="50"></el-table-column>
                <el-table-column prop="wfCompany" label="产废单位"></el-table-column>
                <el-table-column prop="wfCode" label="危废类别"></el-table-column>
                <el-table-column prop="wfName" label="危废种类"></el-table-column>
                <el-table-column prop="wfWeight" label="预警量"></el-table-column>
                <el-table-column prop="unit" label="单位"></el-table-column>
                <el-table-column label="预警时间">
                  <template slot-scope='scope'>
                    <span>{{$dateFormat(scope.row.createAt,'yyyy-MM-dd hh:mm:ss')}}</span>
                  </template>
                </el-table-column>
                <el-table-column label="操作">
                  <template slot-scope="scope">
                    <el-button type="text" size="small" @click="orderAllots(scope.row)">分配</el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <el-pagination @size-change="handleSizeChange1" @current-change="handleCurrentChange1" :current-page="currentPage1" :page-sizes="[10, 20, 30, 40]" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="total1"></el-pagination>
          </div>
        </div>
        <div v-if="orderAllotRecall">
          <div class="orderAllotRecallHead">
            <span class="orderAllotRecallHeadInfo">订单分配</span>
          </div>
          <div class="orderAllotRecallForm">
            <el-form :inline="true" :model="orderFormInline" class="demo-form-inline">
              <el-form-item label="产废单位:">
                <template>{{ orderFormInline.wasteProducingUnit }}</template>
              </el-form-item>
              <el-form-item label="处置单位:">
                <template>{{ orderFormInline.disposalUnit }}</template>
              </el-form-item>
              <el-form-item label="运输单位:">
                <el-select @change='getcurrentval' v-model="formInline.ysCompany" filterable remote reserve-keyword placeholder="请输入关键词" :remote-method="remoteMethod" :loading="loading">
                  <el-option v-for="item in options4" :key="item.value" :label="item.label" :value="item.value"></el-option>
                </el-select>
              </el-form-item>
            </el-form>
          </div>
          <div>
            <el-table ref="multipleTable" :data="orderAllotRecallTableData" border tooltip-effect="dark" style="width: 100%" @select="handleSelectionChange">
              <el-table-column type="selection" :selectable='selectable'></el-table-column>
              <el-table-column prop="wfCode" label="危废类别"></el-table-column>
              <el-table-column prop="wasteTypeName" label="危废种类"></el-table-column>
              <el-table-column prop="warningTransport" label="预警量" show-overflow-tooltip></el-table-column>
              <el-table-column prop="total" label="当前库存量" show-overflow-tooltip></el-table-column>
              <el-table-column prop="unit" label="单位" show-overflow-tooltip></el-table-column>
              <el-table-column label="运输量" show-overflow-tooltip>
                <template slot-scope="scope">
                  <el-input size="small" v-model="scope.row.wfWeight" type='number'></el-input>
                </template>
              </el-table-column>
            </el-table>
          </div>
          <div class="orderAllotRecallButtom">
            <el-button type="primary" @click="toggleSelection()">确定分配</el-button>
            <el-button type="primary" @click='reload()'>取消</el-button>
          </div>
        </div>
      </div>
    </div>
    <!--订单新增 是手动新增-->
    <div v-if="!increased">
      <el-button type="text" size="medium" @click="orderGoBack">返回</el-button>
    </div>
    <div v-if="increasedTable">
      <div>
        <el-form :inline="true" :model="orderFormInline" class="demo-form-inline">
          <el-form-item label="产废单位:">
            <template>{{ currentLoginCompany }}</template>
          </el-form-item>
          <el-form-item label="处置单位">
            <el-select v-model="manual.czCompany" placeholder="处置单位" @change='getManualValue'>
              <el-option :label="item.companyName" :value="item.id" v-for="item in czCompany" :key="item.id"></el-option>
            </el-select>
          </el-form-item>
          <!--  <el-form-item label="运输单位:">
            <el-select @change='getcurrentval' v-model="formInline.ysCompany" filterable remote reserve-keyword placeholder="请输入关键词" :remote-method="remoteMethod" :loading="loading">
              <el-option v-for="item in options4" :key="item.value" :label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item> -->
        </el-form>
      </div>
      <div class="orderAllotRecallHead">
        <span class="orderAllotRecallHeadInfo">订单分配</span>
      </div>
      <div class="orderAllotRecallForm">
      </div>
      <div>
        <el-table ref="multipleTable" :data="orderAllotRecallTableData" border tooltip-effect="dark" style="width: 100%" @select="handleSelectionChange">
          <el-table-column type="selection" :selectable='selectable'></el-table-column>
          <el-table-column prop="wfCode" label="危废类别"></el-table-column>
          <el-table-column prop="wasteTypeName" label="危废种类"></el-table-column>
          <el-table-column prop="warningTransport" label="预警量" show-overflow-tooltip></el-table-column>
          <el-table-column prop="total" label="当前库存量" show-overflow-tooltip></el-table-column>
          <el-table-column prop="unit" label="单位" show-overflow-tooltip></el-table-column>
          <el-table-column prop="warningTime" label="预警时间" show-overflow-tooltip></el-table-column>
          <el-table-column label="运输量" show-overflow-tooltip>
            <template slot-scope="scope">
              <!-- <el-input size="small" v-model="scope.row.total" type='number' v-if='scope.row.warningTime!=null'></el-input>
              <el-input size="small" v-model="scope.row.wfWeight" type='number' v-if='scope.row.warningTime==null'></el-input> -->
              <el-input size="small" v-model="scope.row.wfWeight" type='number'></el-input>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="orderAllotRecallButtom">
        <el-button type="primary" @click="toggleSelection()">确定新增</el-button>
        <el-button type="primary" @click='reload()'>取消</el-button>
        <!-- <el-button type="primary">重置</el-button> -->
      </div>
    </div>
  </div>
</template>
<script>
export default {
  inject: ['reload'],
  data() {
    return {
      currentLoginType: null,
      dialogVisibleAmend: false,
      dialogVisibleRecall: false,
      dialogAmend: "",
      dialogRecall: "",
      tables: [],
      total: 0,
      counts: 0,
      isAdmin: false,
      dialogAmendTables: [],
      dialogRecallTables: [],
      orderAllotTables: [],
      orderAllotRecallTableData: [],
      transportations: 0,
      increasedTableData: [],
      formInline: {
        companyType: '',
        wasteType: "",
        czCompany: "",
        ysCompany: "",
        cfCompany: "",
        startTime: '',
        endTime: '',
        timer: [],
        wfCode: ''

      },

      transportForm: {
        cfCompany: "",
      },
      orderFormInline: {
        wasteProducingUnit: "",
        disposalUnit: ""
      },
      pickerOptions2: {
        shortcuts: [{
            text: "最近一周",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit("pick", [start, end]);
            }
          },
          {
            text: "最近一个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit("pick", [start, end]);
            }
          },
          {
            text: "最近三个月",
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit("pick", [start, end]);
            }
          }
        ]
      },
      currentPage: 1,
      currentPage1: 1,
      isOrder: true,
      isorderAllot: false,
      increased: true,
      increasedTable: false,
      orderAllotRecall: false,
      multipleSelection: [],
      increasedMultipleSelection: [],
      value5: "",
      page: 1,
      limit: 10,
      page1: 1,
      limit1: 10,
      total1: 0,
      cfCompany: "",
      czCompany: [],
      czCompanyUpdate: [],
      ysCompany: [],
      ysCompanyUpdate: [],
      options4: [],
      value: this.val,
      list: [],
      loading: false,
      states: [],
      wastetypeList: [],
      orderDown: [],
      jugeCompanyType: true,
      DeliverCZCompany: [],
      currentSelectCode: '',
      currentLoginCompany: '',
      manual: {
        czCompany: ''
      },
      mytabels: [],
      updateInfo: {
        companyType: '',
        wasteType: "",
        czCompany: "",
        ysCompany: "",
        cfCompany: "",
        startTime: '',
        endTime: '',
        timer: [],
        wfCode: ''
      },
      isChangeInfoYsCompany: '',
      ischangeInfoWFweight: '',
      editInfoData: []
    };
  },
  mounted() {

    this.currentLoginCompany = localStorage.companyName;
    this.initList();
    this.initCompanyList(1);
    this.getWasteType()
    this.$common.$ajax("/sys/company/select", { companyType: 3 }, "get").then(res => {
        this.ysCompanyUpdate = res.data.body;
        this.list = res.data.body.map(item => {
          return { value: item.id, label: item.companyName };
        });

      })
      .catch(err => {
        alert(err);
      });



    if (localStorage.companyType == 6) {
      this.isAdmin = true
    } else {
      this.isAdmin = false
      this.jugeCompanyType = false; //产废单位是手动添加
      // 判断当前用户登录类型
      if (localStorage.companyType == 4 || localStorage.companyType == 2) { //处置和运营为分配
        this.jugeCompanyType = true;

      }
    }
  },
  methods: {

    updateYsCompany(val, id) {
      console.log(val)
      console.log(id)
      // this.isChangeInfoYsCompany = val;

      this.editInfoData.forEach(item => {
        if (item.id == id) {
          item.ysId = val
        } else {
          return
        }
      })
    },
    getCurrentWFweight(val, id) {
      console.log(val)
      console.log(id)
      // this.ischangeInfoWFweight = val
      this.editInfoData.forEach(item => {
        if (item.id == id && val <= item.total) {
          item.wfWeight = val
        } else {
          this.$message({
            type: 'error',
            message: '当前输入重量大于库存量,请检查输入'
          })
          return
        }
      })
    },
    // 获取手动分配订单中处置公司请求数据

    getManualValue(val) {
      // this.manual.czCompany = val;
      this.$common.$ajax('/op/dispatch/findMaxByCompanyId', { companyId: localStorage.czCompanyId, dpId: val }, 'get').then(res => {
        console.log('产废查找所有危废')
        console.log(res.data)
        this.orderAllotRecallTableData = res.data.body;

      })
    },
    selectable(row, index) {
      if (this.currentSelectCode == '') {
        return true
      } else {

        if (row.wfCode == this.currentSelectCode) {
          return true
        } else {
          return false
        }
      }

    },
    unfold(e, id) {
      var isUnfold = false;
      // 获取当前的子列表
      var child_node =
        e.currentTarget.parentElement.parentElement.nextElementSibling;
      if (e.currentTarget.classList.contains("el-icon-circle-plus-outline")) {
        child_node.style.display = "block";
        e.currentTarget.classList.add("el-icon-remove-outline");
        e.currentTarget.classList.remove("el-icon-circle-plus-outline");
        console.log('我是展开啦')

      } else {
        child_node.style.display = "none";
        e.currentTarget.classList.add("el-icon-circle-plus-outline");
        e.currentTarget.classList.remove("el-icon-remove-outline");
      }
    },

    // 重置
    resetConditions() {

      for (let item in this.formInline) {
        console.log(item)

        if (Array.isArray(this.formInline[item])) {
          this.formInline[item] = []
        } else {
          this.formInline[item] = ''
        }
      }
      this.initList();
    },
    //搜索
    searchResult() {
      this.initList()
    },
    //   初始化订单数据列表
    initList() {
      this.$common
        .$ajax(
          "/op/order/findOrder", {
            page: this.page,
            limit: this.limit,
            opId: this.formInline.czCompany,
            wfId: this.formInline.companyType,
            ysId: this.formInline.ysCompany,
            wfCode: this.formInline.wasteType,
            startTime: this.formInline.timer[0] || '',
            endTime: this.formInline.timer[1] || '',

          },
          "get"
        )
        .then(res => {
          console.log('123123123');
          res.data.body.list.forEach(item => {
            item.children = []
            this.$common.$ajax('/op/order/findOrderInfo', { id: item.id }, 'get').then(res => {
              // console.log(res.data)
              // this.orderDown = res.data.body
              item.children = res.data.body
            })
            console.log(item)
          })
          this.tables = res.data.body.list;

          this.total = res.data.body.total;
        });
    },
    // 初始化产废公司列表
    initCompanyList(id) {
      this.$common
        .$ajax(
          "/sys/company/select", {
            companyType: id
          },
          "get"
        )
        .then(res => {
          //   console.log(res.data);
          this.cfCompany = res.data.body;
        });
    },
    // 根据产废单位获取处置单位
    getValue(id) {
      this.$common
        .$ajax(
          "/sys/company/findDPCompany", {
            wfCompanyId: id
          },
          "get"
        )
        .then(res => {
          console.log(res.data);
          this.czCompany = res.data.body;
          this.czCompanyUpdate = res.data.body;
        });
    },

    // 运输单位输入搜索
    remoteMethod(query) {
      if (query !== "") {
        this.loading = true;

        setTimeout(() => {
          this.loading = false;
          this.options4 = this.list.filter(item => {
            return item.label.indexOf(query) > -1;
          });
        }, 200);
      } else {
        this.options4 = [];
      }
    },
    //获取危废列表
    getWasteType() {
      this.$common.$ajax('/wf/wastetype/wastetype', {}, 'get').then(res => {
        console.log(res.data)
        this.wastetypeList = res.data.body
      })
    },
    //订单分配
    onPrimary() {
      this.isOrder = false;
      this.getOrderDeliverList(this.transportForm.cfCompany)
    },
    orderGoBack() {
      // this.isOrder = true;
      this.reload()
    },
    // 获取订单分配列表
    getOrderDeliverList(id) {
      this.$common.$ajax('/op/order/findTransport', {
        page: this.page1,
        limit: this.limit1,
        wfId: id
      }, 'get').then(res => {
        console.log(res.data)
        this.orderAllotTables = res.data.body.list;
        this.total1 = res.data.body.total;
      })
    },
    getcurrentval(val) {
      console.log(val)
      this.multipleSelection.forEach(item => {
        item.ysId = val
      })
    },
    // 分配操作开始
    orderAllots(row) {
      console.log(row);
      this.orderAllotRecall = true;
      console.log(this.orderAllotRecall);
      // 开始赋值
      this.orderFormInline.wasteProducingUnit = row.wfCompany;
      this.orderFormInline.disposalUnit = row.dpCompanyName;

      // this.orderFormInline.disposalUnit =
      // 显示表格数据
      this.$common.$ajax('/op/dispatch/findMaxByCompanyId', { companyId: row.wfId, dpId: row.dpId }, 'get').then(res => {
        console.log('产废查找所有危废')
        console.log(res.data)
        this.orderAllotRecallTableData = res.data.body;

      })
    },
    handleEdit(row) {

      this.dialogVisibleAmend = true;
      this.dialogAmend = "修改";
      // this.$common.$ajax('/op/order/updateOrder', [], 'post').then(res => {
      //   console.log('this is edit')
      //   console.log(res.data)
      // })
      // 
      // 
      //获取详情并且通过 产废公司Id 获取 处置公司
      this.$common.$ajax('/op/order/findOrderInfo', {
        id: row.id
      }, 'get').then(res => {
        console.log(res.data.body)
        this.editInfoData = res.data.body
        this.dialogAmendTables = res.data.body;
        this.getValue(row.id)
      })
    },
    toggleSelection(rows) {
      console.log(this.multipleSelection);

      if (this.multipleSelection.length == 0) {
        this.$message({
          type: 'warn',
          message: '请选择一条数据'
        })
      } else {
        this.multipleSelection.forEach(item => {
          if (item.wfWeight == 0) {
            this.$message({
              type: 'warn',
              message: '请输入运输量'
            })

          } else if (item.wfWeight > item.total) {

            this.$message({
              type: 'warn',
              message: '运输量大于库存量，请重新输入'
            })
          } else {
            this.counts++;
          }

        })
        console.log(this.counts)
        if (this.counts == this.multipleSelection.length && this.counts != 0) {
          this.$common.$ajax('/op/order/distribution', this.multipleSelection, 'post').then(res => {

            this.$message({
              type: 'success',
              message: '操作成功'
            })
            this.reload()
          })
        }
      }




    },
    handleSelectionChange(val) {
      console.log(val)

      this.multipleSelection = val;
      if (val.length == 0) {
        this.currentSelectCode = ''
      } else {
        val.forEach(item => {
          console.log(item)
          item.ysId = this.formInline.ysCompany;
        })
        this.multipleSelection = val
        this.currentSelectCode = val[0].wfCode;
      }

    },
    onSubmitorderAllot() {
      this.isorderAllot = true;
      // 查询
      this.getOrderDeliverList();
    },
    onResetorderAllot() {
      this.transportForm.cfCompany = ''
      this.getOrderDeliverList();
    },
    onSubmit() {},
    //订单新增---s手动
    onIncreased() {
      this.increased = false;
      this.increasedTable = true;
      this.getValue(localStorage.czCompanyId)

      // this.getOrderDeliverList(111)

    },

    // 订单修改
    confirmUpdate() {
      // 构建传参对象 array
      // let arr = new Array();
      // this.editInfoData.forEach(item => {
      //   item.wfWeight = item.wfWeight * 1000
      // })
      this.$common.$ajax('/op/order/updateOrder', this.editInfoData, 'post').then(res => {
        console.log('订单修改成功啦')
        this.$message({
          type: 'success',
          message: "订单修改成功"
        })
        this.reload()
      })
    },
    increasedGoBack() {
      this.increased = true;
    },
    onSubmitIncreased() {
      this.increasedTable = true;
    },
    increasedHandleSelectionChange(val) {
      this.increasedMultipleSelection = val;
    },
    increasedToggleSelection() {
      this.increasedTable = false;
      this.increased = true;
    },
    recall(row) { //撤回
      console.log(row)
      this.dialogVisibleRecall = true;
      this.dialogRecall = "撤回";
      this.$confirm("此操作将永久撤回该选项, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$common.$ajax("/op/order/revokeOrder", { id: row.id }, "get").then(res => {
          if (res.data.status === 200) {
            this.$message({
              type: "success",
              message: "撤回成功!"
            });
            this.reload();
          }
        });
      }).catch(() => {
        this.$message({
          type: "info",
          message: "已取消撤回"
        });
      });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.limit = val;
      this.initList();
    },
    handleSizeChange1(val) {
      console.log(`每页 ${val} 条`);
      this.limit1 = val;
      this.getOrderDeliverList()
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.page = val;
      this.initList();
    },
    handleCurrentChange1(val) {
      console.log(`当前页: ${val}`);
      this.page1 = val;
      this.getOrderDeliverList()

    }
  },
  components: {}
};

</script>
<style lang="scss">
.demo-form-inline {
  padding-left: 20px;
}

.elHight {
  height: auto !important;
}

.order {
  border-radius: 10px;
  padding-top: 30px;
  background-color: #f7f7f7;
}

.result span {
  font-size: 15px;
  margin-left: 20px;
}

.speculation {
  margin-top: 10px;
}

.orderAllot {
  border-radius: 10px;
  padding-top: 20px;
  background-color: #ffffff;
}

.orderAllotHead {
  /*color: #959595;*/
}

.orderAllotHeadInfo {
  font-size: 32px;
  font-weight: 500;
}

.orderAllotHeadNum {
  font-size: 24px;
  margin-left: 25px;
  font-weight: 400;
}

.orderAllotForm {
  border-radius: 10px;
  margin-top: 20px;
  padding-top: 30px;
  background-color: #f7f7f7;
}

.orderAllotFormTable {
  margin-left: 20px;
  margin-right: 20px;
  border: 1px solid #cccccc;
}

.orderAllotRecallForm {
  margin-top: 30px;
}

.orderAllotRecallHead {
  margin-top: 30px;
  /*color: #959595;*/
}

.orderAllotRecallHeadInfo {
  font-size: 32px;
  font-weight: 500;
}

.orderAllotRecallButtom {
  margin-top: 30px;
}

.menuList {
  width: 100%;
  margin-top: 30px;

  .menuTitle {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #ebeef5;

    li {
      height: 40px;
      // width: 18%;
      width: calc(100% / 7);

      span {
        font-size: 16px;
        display: inline-block;
        height: 100%;
        line-height: 40px;
        width: 100%;

        text-align: left;
      }

      // &:nth-child(3) {
      // width: 10%
      // }
    }
  }

  .menuBody {
    border-bottom: 1px solid #ebeef5;
    width: 100%;

    li.menuitem {
      width: 100%;

      div {
        height: 50px;
        display: flex;
        width: calc(100% / 7);
        align-items: center;
        font-size: 14px;

        // &:nth-child(3) {
        //   width: 10%
        // }

        a {
          margin-right: 15px;
          color: #409eff;

          &:hover {
            cursor: pointer;
            color: #1268c1;
          }
        }
      }
    }
  }

  .subMenu {
    width: 100%;
    min-height: 50px;
    display: none;
    padding-left: 20px;

    .subItem {
      width: 100%;
      height: 50px;

      div {
        float: left;
      }
    }
  }
}

</style>
